package com.zcs.app.wisdomschool.ui.fragment;

import android.content.Intent;
import android.os.Handler;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.greateffect.littlebud.lib.base.BaseNormalFragmentAdvSimple;
import com.greateffect.littlebud.lib.cache.CustomExtraKeys;
import com.greateffect.littlebud.lib.provider.PicProvider;
import com.greateffect.littlebud.lib.utils.GlideStaticUtils;
import com.zcs.app.wisdomschool.R;
import com.zcs.app.wisdomschool.ui.ProcessListActivity_;

import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EFragment;
import org.androidannotations.annotations.ViewById;

/**
 * Created by ZengCS on 2019/9/24.
 * E-mail:zengcs@vip.qq.com
 * Add:成都市天府软件园E3
 * Desc:类说明
 */
@EFragment(R.layout.fragment_home)
public class HomeFragment extends BaseNormalFragmentAdvSimple {
//    @ViewById(R.id.id_iv_item_1_pic)
//    ImageView pic1;
//    @ViewById(R.id.id_iv_item_2_pic)
//    ImageView pic2;
    @ViewById(R.id.id_container_toolbar)
    ViewGroup mToolbarContainer;

    @Override
    protected void initData() {
//        new Handler().postDelayed(() -> {
//            GlideStaticUtils.displayImage(PicProvider.get(), R.drawable.empty_photo, pic1);
//            GlideStaticUtils.displayImage(PicProvider.get(), R.drawable.empty_photo, pic2);
//        }, 200);
        super.setToolbarPaddingWhenTransStatusBar(mToolbarContainer);
    }

    @Click({
            R.id.id_tv_view_all,
            R.id.id_index_tool_1,
            R.id.id_index_tool_2,
            R.id.id_index_tool_3,
            R.id.id_bg_item_1,
            R.id.id_bg_item_2,
    })
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.id_tv_view_all:
            case R.id.id_bg_item_1:
            case R.id.id_bg_item_2:
                openProcessList(0);// 查看全部
                break;
            case R.id.id_index_tool_1:
                openProcessList(1);// 日常事务
                break;
            case R.id.id_index_tool_2:
                openProcessList(3);// 资助评定
                break;
            case R.id.id_index_tool_3:
                openProcessList(2);// 评奖评优
                break;
        }
    }

    private void openProcessList(int index) {
        Intent intent = new Intent(getAttachedContext(), ProcessListActivity_.class);
        intent.putExtra(CustomExtraKeys.KEY_INTEGER, index);
        launchActivity(intent);
    }
}
